/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ifm;

import java.util.Random;

/**
 *
 * @author morfant
 */
public class InformationFlowsModeling {

    /**
     * @param args the command line arguments
     */
    public static void mains(String[] args) {

        int base = 10;

        Random rand = new Random(System.currentTimeMillis());
        double[] uniformRandomValue = new double[base];

        for (int i = 0; i < base; i++) {
            uniformRandomValue[i] = rand.nextDouble();
        }

        for (int i = 0; i < base; i++) {
            System.out.print(uniformRandomValue[i] + " ");
        }
        System.out.println();

        double lambda = 0.1;

        for (int i = 0; i < base; i++) {
            uniformRandomValue[i] = (-1.0 / lambda) * Math.log(uniformRandomValue[i]);
        }

        for (int i = 0; i < base; i++) {
            System.out.print(uniformRandomValue[i] + " ");
        }
        System.out.println();

        double[] events = new double[base + 1];
        events[0] = 0;

        for (int i = 1; i < base + 1; i++) {
            events[i] = events[i - 1] + uniformRandomValue[i - 1];
        }

        for (int i = 0; i < base; i++) {
            System.out.print(events[i] + " ");
        }
        System.out.println();

    }
}
